package c8.strategy;

public class ValidateTest {
    public static void main(String[] args){
        Validator lowerCaseValidator=new Validator(new IsAllLowerCase());
        Validator numericValidator=new Validator(new IsNumeric());
        System.out.println(lowerCaseValidator.validate("aaa"));
        System.out.println(numericValidator.validate("ccc"));

        //java8方式，不需要写具体的实现类
        Validator lowerCaseValidator2=new Validator(s->s.matches("[a-z]+"));
        Validator numericValidator2=new Validator(s->s.matches("\\d+"));
        System.out.println(lowerCaseValidator2.validate("Aaa"));
        System.out.println(numericValidator2.validate("111"));
    }
}
